home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / assembler-tools / apathysource / fastest / fastest2.s < prev    next >
Encoding:
Text File  |  1980-02-03  |  21.0 KB  |  940 lines

  1. ;;; "                 Includes & Defines"
  2.            Machine   68020
  3.            Incdir    "!Includes:"
  4.            Include   "StdLibInc.i"
  5.            Include   "StdHardInc.i"
  6.  
  7.            Include   "Loader.i"
  8.            Include   "Support.i"
  9.            Include   "Demo.i"
  10.  
  11.            Incdir    "!Includes:os3.0/"
  12.            Include   "exec/memory.i"
  13.  
  14.            xdef      Fastest_Init
  15.            xdef      Fastest_Show
  16.            xdef      Fastest_Counter
  17.            xdef      Fastest_Main
  18.            xdef      Fastest_Remove
  19.  
  20.            xdef      Fastest_Angle
  21.            xdef      Fastest_Zoom
  22.            xdef      Fastest_XOff
  23.            xdef      Fastest_YOff
  24.  
  25.            xdef      Texture
  26.  
  27. Fastest_ID         Equ       101
  28. SprCol             Equ       $0
  29. NoGrid             Equ       0
  30. Grey               Equ       0
  31. Dither             Equ       1
  32. MBlur              Equ       1
  33.  
  34. DIST               Equ       180
  35.  
  36.            IFEQ      Grey
  37.  
  38. _Farg0             Equ       $0004
  39. _Farg1             Equ       $0015
  40. _Farg2             Equ       $0026
  41. _Farg3             Equ       $0137
  42. _Farg4             Equ       $0248
  43. _Farg5             Equ       $0359
  44. _Farg6             Equ       $046a
  45. _Farg7             Equ       $057b
  46.  
  47. _Farg8             Equ       $068c
  48. _Farg9             Equ       $079d
  49. _Farg10            Equ       $08ae
  50. _Farg11            Equ       $09bf
  51. _Farg12            Equ       $0acf
  52. _Farg13            Equ       $0bdf
  53. _Farg14            Equ       $0cef
  54. _Farg15            Equ       $0dff
  55.  
  56.            ELSE
  57.  
  58. _Farg0             Equ       $0000
  59. _Farg1             Equ       $0111
  60. _Farg2             Equ       $0222
  61. _Farg3             Equ       $0333
  62. _Farg4             Equ       $0444
  63. _Farg5             Equ       $0555
  64. _Farg6             Equ       $0666
  65. _Farg7             Equ       $0777
  66.  
  67. _Farg8             Equ       $0888
  68. _Farg9             Equ       $0999
  69. _Farg10            Equ       $0aaa
  70. _Farg11            Equ       $0bbb
  71. _Farg12            Equ       $0ccc
  72. _Farg13            Equ       $0ddd
  73. _Farg14            Equ       $0eee
  74. _Farg15            Equ       $0fff
  75.  
  76.            ENDC
  77.  
  78. Farg0              Equ        SprCol
  79. Farg1              Equ        SprCol
  80. Farg2              Equ        SprCol
  81. Farg3              Equ        SprCol
  82. Farg4              Equ        SprCol
  83. Farg5              Equ        SprCol
  84. Farg6              Equ        SprCol
  85. Farg7              Equ        SprCol
  86.  
  87. Farg8              Equ        SprCol
  88. Farg9              Equ        SprCol
  89. Farg10             Equ        SprCol
  90. Farg11             Equ        SprCol
  91. Farg12             Equ        SprCol
  92. Farg13             Equ        SprCol
  93. Farg14             Equ        SprCol
  94. Farg15             Equ        SprCol
  95.  
  96. ;;;
  97.  
  98.            xref      _SetColByte
  99.  
  100.  
  101.  
  102. ***************************************
  103. *       Exempel/TestProgram...        *
  104. ***************************************
  105.  
  106.            Section   code,CODE
  107.  
  108.            IFND      noexample
  109. ;;; "                 Example"
  110. Start:             Jsr       _InitDemo
  111.            Tst.l     d0
  112.            Bne       Exit
  113.  
  114. PlayMusic:         Bsr       _PlayMusic
  115.            Tst.l     d0
  116.            Bne       Uninit
  117.  
  118.            Bsr       Fastest_Init
  119.            Tst.l     d0
  120.            Bne       StopMusic
  121.  
  122.            Bsr       Fastest_Show
  123.  
  124. Main:              Bsr       _Sync
  125.  
  126.            Move.w    #$0020,$dff106
  127.            Move.w    #$0a00,$dff180
  128.  
  129.            Bsr       Fastest_Counter
  130.            Bsr       Fastest_Main
  131.  
  132.            Move.w    #$0020,$dff106
  133.            Move.w    #$0000,$dff180
  134.  
  135.            Btst      #6,$bfe001
  136.            Bne       Main
  137. .waitlop           Btst      #6,$bfe001
  138.            Beq       .waitlop
  139.  
  140.            Bsr       Fastest_Remove
  141.  
  142. StopMusic:         Bsr       _StopMusic
  143. Uninit:            Bsr       _UninitDemo
  144. Exit:              Moveq     #0,d0
  145.            Rts
  146. ;;;
  147.            ENDC
  148.  
  149. ***************************************
  150. *       Subrutiner nedanför....       *
  151. ***************************************
  152.  
  153. Fastest_Init:
  154. ;;; "                 Alloc CopperList"
  155. AllocCopper:       Move.l    #10*1024,d0
  156.            Move.l    #Fastest_ID,d1
  157.            Jsr       _AllocChip
  158.            Tst.l     d0
  159.            Beq       InitError
  160.            Move.l    d0,CopperPtr
  161. ;;;
  162. ;;; "                 Init CopperList"
  163. InitCList:         Move.l    CopperPtr,a0
  164.  
  165.            Move.l    #$008e2c81,(a0)+     ; DIWSTRT
  166.            Move.l    #$00902cc1,(a0)+     ; DIWSTOP
  167.            Move.l    #$00920038,(a0)+     ; DDFSTRT
  168.            Move.l    #$009400d0,(a0)+     ; DDFSTOP
  169.            Move.l    #$01000211,(a0)+     ; BPLCON0
  170.            Move.l    #$01020010,(a0)+     ; BPLCON1
  171.            Move.l    #$01040024,(a0)+     ; BPLCON2
  172.            Move.l    #$01060020,(a0)+     ; BPLCON3 ($0020 = copborder)
  173.            Move.w    #$0108,(a0)+         ; BPLMOD1
  174.            Move.w    #-8,(a0)+
  175.            Move.w    #$010a,(a0)+         ; BPLMOD2
  176.            Move.w    #-8,(a0)+
  177.            Move.l    #$010c0000,(a0)+     ; Sprite palette = 31
  178.            Move.l    #$01fc000f,(a0)+     ; FETCHMODE
  179.  
  180.            ;-----------------------------------
  181.  
  182.            Move.l    a0,BplPtr
  183.            Move.l    #$00e00000,(a0)+     ; BPL1PTH
  184.            Move.l    #$00e20000,(a0)+     ; BPL1PTL
  185.            Move.l    #$00e40000,(a0)+     ; BPL1PTL
  186.            Move.l    #$00e60000,(a0)+     ; BPL1PTL
  187.            Move.l    #$00e80000,(a0)+     ; BPL1PTL
  188.            Move.l    #$00ea0000,(a0)+     ; BPL1PTL
  189.            Move.l    #$00ec0000,(a0)+     ; BPL1PTL
  190.            Move.l    #$00ee0000,(a0)+     ; BPL1PTL
  191.  
  192.            Move.l    a0,BplPtr2
  193.            Move.l    #$00f00000,(a0)+     ; BPL1PTH
  194.            Move.l    #$00f20000,(a0)+     ; BPL1PTL
  195.            Move.l    #$00f40000,(a0)+     ; BPL1PTL
  196.            Move.l    #$00f60000,(a0)+     ; BPL1PTL
  197.            Move.l    #$00f80000,(a0)+     ; BPL1PTL
  198.            Move.l    #$00fa0000,(a0)+     ; BPL1PTL
  199.            Move.l    #$00fc0000,(a0)+     ; BPL1PTL
  200.            Move.l    #$00fe0000,(a0)+     ; BPL1PTL
  201.  
  202.            ;--------------------------------
  203.  
  204.            Move.l    a0,SprPtr
  205.            Move.l    #$01200000,(a0)+     ; SPRxPT
  206.            Move.l    #$01220000,(a0)+     ; SPRxPT
  207.            Move.l    #$01240000,(a0)+     ; SPRxPT
  208.            Move.l    #$01260000,(a0)+     ; SPRxPT
  209.            Move.l    #$01280000,(a0)+     ; SPRxPT
  210.            Move.l    #$012a0000,(a0)+     ; SPRxPT
  211.            Move.l    #$012c0000,(a0)+     ; SPRxPT
  212.            Move.l    #$012e0000,(a0)+     ; SPRxPT
  213.            Move.l    #$01300000,(a0)+     ; SPRxPT
  214.            Move.l    #$01320000,(a0)+     ; SPRxPT
  215.            Move.l    #$01340000,(a0)+     ; SPRxPT
  216.            Move.l    #$01360000,(a0)+     ; SPRxPT
  217.            Move.l    #$01380000,(a0)+     ; SPRxPT
  218.            Move.l    #$013a0000,(a0)+     ; SPRxPT
  219.            Move.l    #$013c0000,(a0)+     ; SPRxPT
  220.            Move.l    #$013e0000,(a0)+     ; SPRxPT
  221.  
  222.            ;--------------------
  223.  
  224.            Move.l    #$2c,d0
  225.            Move.l    #64+42-1,d7
  226.  
  227. .lop1              Move.l    d0,d1
  228.            Swap      d1
  229.            Lsl.l     #8,d1
  230.            Or.l      #$0001fffe,d1
  231.            Move.l    d1,(a0)+
  232.  
  233.            Move.w    #$0108,(a0)+
  234.            Move.w    #-48,(a0)+
  235.            Move.w    #$010a,(a0)+
  236.            Move.w    #-48,(a0)+
  237.            Move.l    #$01020010,(a0)+
  238.  
  239.            Move.l    d0,d1
  240.            Addq.l    #1,d1
  241.            Swap      d1
  242.            Lsl.l     #8,d1
  243.            Or.l      #$0001fffe,d1
  244.            Move.l    d1,(a0)+
  245.  
  246.            Move.w    #$0108,(a0)+
  247.            Move.w    #-8,(a0)+
  248.            Move.w    #$010a,(a0)+
  249.            Move.w    #-8,(a0)+
  250.            Move.l    #$01020021,(a0)+
  251.  
  252.            Addq.l    #2,d0
  253.            Dbra      d7,.lop1
  254.  
  255.            ;--------------------------
  256.  
  257.            Move.l    #$ffd9fffe,(a0)+
  258.  
  259.            Move.l    #0,d0
  260.            Move.l    #22-1,d7
  261.  
  262. .lop2              Move.l    d0,d1
  263.            Swap      d1
  264.            Lsl.l     #8,d1
  265.            Or.l      #$0001fffe,d1
  266.            Move.l    d1,(a0)+
  267.  
  268.            Move.w    #$0108,(a0)+
  269.            Move.w    #-48,(a0)+
  270.            Move.w    #$010a,(a0)+
  271.            Move.w    #-48,(a0)+
  272.            Move.l    #$01020010,(a0)+
  273.  
  274.            Move.l    d0,d1
  275.            Addq.l    #1,d1
  276.            Swap      d1
  277.            Lsl.l     #8,d1
  278.            Or.l      #$0001fffe,d1
  279.            Move.l    d1,(a0)+
  280.  
  281.            Move.w    #$0108,(a0)+
  282.            Move.w    #-8,(a0)+
  283.            Move.w    #$010a,(a0)+
  284.            Move.w    #-8,(a0)+
  285.            Move.l    #$01020021,(a0)+
  286.  
  287.            Addq.l    #2,d0
  288.            Dbra      d7,.lop2
  289.  
  290.            Move.l     #$fffffffe,(a0)+     ; End of list
  291. ;;;
  292. ;;; "                 Init Screen"
  293. InitScreen:
  294.            Move.l    #40*128*4,d0
  295.            Move.l    #Fastest_ID,d1
  296.            Jsr       _AllocChip
  297.            Tst.l     d0
  298.            Beq       InitError
  299.            Move.l    d0,ScrPtr1
  300.            Add.l     #5120,d0
  301.            Move.l    d0,ScrPtr2
  302.            Add.l     #5120,d0
  303.            Move.l    d0,ViewPtr1
  304.            Add.l     #5120,d0
  305.            Move.l    d0,ViewPtr2
  306.  
  307.            ;------------------------
  308.  
  309.            Move.l    BplPtr,a0
  310.            Move.l    ScrPtr1,d1
  311.            Moveq     #2-1,d2
  312.            Move.l    #0,d0
  313.            Jsr       _SetPtrs
  314.  
  315.            Move.l    BplPtr,a0
  316.            Lea       16(a0),a0
  317.            Move.l    ScrPtr2,d1
  318.            Moveq     #2-1,d2
  319.            Move.l    #0,d0
  320.            Jsr       _SetPtrs
  321.  
  322.            ;- - - - - - - - - - - -
  323.  
  324.            Move.l    BplPtr2,a0
  325.            Move.l    ScrPtr1,d1
  326.            Moveq     #2-1,d2
  327.            Move.l    #0,d0
  328.            Jsr       _SetPtrs
  329.  
  330.            Move.l    BplPtr2,a0
  331.            Lea       16(a0),a0
  332.            Move.l    ScrPtr2,d1
  333.            Moveq     #2-1,d2
  334.            Move.l    #0,d0
  335.            Jsr       _SetPtrs
  336.  
  337.            ;------------------------
  338.  
  339.            Move.l    SprPtr,a0
  340.            Move.l    #SpriteDummy,d1
  341.            Moveq     #7,d2
  342.            Moveq     #0,d0
  343.            Jsr       _SetPtrs
  344. ;;;
  345. ;;; "                 Init Sprites"
  346. InitSprites:       Move.l    #(16*2+16*256)*5,d0
  347.            Move.l    #Fastest_ID,d1
  348.            Jsr       _AllocChip
  349.            Tst.l     d0
  350.            Beq       InitError
  351.            Move.l    d0,Sprite1
  352.  
  353.            ;-------------------------
  354.  
  355.            Move.l    Sprite1,a0
  356.            Moveq     #5-1,d6
  357.            Move.l    #$40,d2
  358.  
  359. .spritelop         Move.l    d2,d0
  360.            Or.l      #$2c00,d0
  361.            Swap      d0
  362.            Move.l    d0,(a0)+
  363.            Add.l     #$20,d2
  364.  
  365.            Clr.l     (a0)+
  366.            Move.l    #$2c020000,(a0)+
  367.            Clr.l     (a0)+
  368.  
  369.            Move.l    #128-1,d7
  370.            Move.l    #$aaaaaaaa,d0
  371.            Move.l    #$55555555,d1
  372.  
  373. .linelop           Move.l    d0,(a0)+
  374.            Move.l    d0,(a0)+
  375.            Move.l    d0,(a0)+
  376.            Move.l    d0,(a0)+
  377.            Move.l    d1,(a0)+
  378.            Move.l    d1,(a0)+
  379.            Move.l    d1,(a0)+
  380.            Move.l    d1,(a0)+
  381.            Dbra      d7,.linelop
  382.  
  383.            Clr.l     (a0)+
  384.            Clr.l     (a0)+
  385.            Clr.l     (a0)+
  386.            Clr.l     (a0)+
  387.            Dbra      d6,.spritelop
  388.  
  389.            ;-------------------------
  390.  
  391.            Move.l    SprPtr,a0
  392.            Move.l    Sprite1,d1
  393.            Moveq     #5-1,d2
  394.            Move.l    #16*2+16*256,d0
  395.            Jsr       _SetPtrs
  396. ;;;
  397.  
  398. ;;; "                 Alloc TextureCopies"
  399. AllocTextures:     Move.l    #256*256*2,d0
  400.            Move.l    #Fastest_ID,d1
  401.            Jsr       _AllocPublic
  402.            Tst.l     d0
  403.            Beq       InitError
  404.            Move.l    d0,TexturePtr1
  405.  
  406.            Move.l    #256*256*2,d0
  407.            Move.l    #Fastest_ID,d1
  408.            Jsr       _AllocPublic
  409.            Tst.l     d0
  410.            Beq       InitError
  411.            Move.l    d0,TexturePtr2
  412. ;;;
  413. ;;; "                 Extract 4-bit Texture"
  414. Extract:           Lea       Texture,a0
  415.            Move.l    TexturePtr1,a1
  416.            Move.l    #256/2*128-1,d7
  417. .lop1
  418.            Move.b    (a0)+,d0
  419.            Move.b    d0,d1
  420.            And.l     #%11110000,d0
  421.            Lsr.l     #4,d0
  422.            And.l     #%00001111,d1
  423.  
  424.            Move.w    d0,(a1)+
  425.            Move.w    d1,(a1)+
  426.  
  427.            Dbra      d7,.lop1
  428. ;;;
  429. ;;; "                 Copy to second half"
  430. Duplicate:         Move.l    TexturePtr1,a0
  431.            Move.l    TexturePtr1,a1
  432.            Add.l     #256*256,a1
  433.  
  434.            Move.l    #256*256/4-1,d7
  435. .copylop1          Move.l    (a0)+,(a1)+
  436.            Dbra      d7,.copylop1
  437. ;;;
  438. ;;; "                 Roll texture 1"
  439. Copy2:             Move.l    TexturePtr1,a0
  440.  
  441.            Move.l    #256*256*2/4-1,d7
  442. .lop
  443.            Move.l    (a0),d0
  444.            Lsl.l     #8,d0
  445.            Move.l    d0,(a0)+
  446.  
  447.            Dbra      d7,.lop
  448. ;;;
  449. ;;; "                 Copy to texture 2"
  450. Copy4:             Move.l    TexturePtr1,a0
  451.            Move.l    TexturePtr2,a1
  452.  
  453.            Move.l    #256*256*2/4-1,d7
  454. .lop
  455.            Move.l    (a0)+,d0
  456.            Lsl.l     #4,d0
  457.            Move.l    d0,(a1)+
  458.  
  459.            Dbra      d7,.lop
  460. ;;;
  461. ;;; "                 Rts"
  462.            Moveq     #0,d0
  463.            Rts
  464.  
  465. InitError:         Move.l    #Fastest_ID,d0
  466.            Bsr       _FreeMany
  467.            Moveq     #1,d0
  468.            Rts
  469. ;;;
  470.  
  471. Fastest_Show:
  472.            IFD       hehe
  473. ;;; "                 Init Colours"
  474. InitCols1:         Move.w    #$0020,$dff106
  475.  
  476.            Move.w    #_Farg0,$dff180
  477.            Move.w    #_Farg1,$dff182
  478.            Move.w    #_Farg2,$dff184
  479.            Move.w    #_Farg3,$dff186
  480.            Move.w    #_Farg4,$dff188
  481.            Move.w    #_Farg5,$dff18a
  482.            Move.w    #_Farg6,$dff18c
  483.            Move.w    #_Farg7,$dff18e
  484.            Move.w    #_Farg8,$dff190
  485.            Move.w    #_Farg9,$dff192
  486.            Move.w    #_Farg10,$dff194
  487.            Move.w    #_Farg11,$dff196
  488.            Move.w    #_Farg12,$dff198
  489.            Move.w    #_Farg13,$dff19a
  490.            Move.w    #_Farg14,$dff19c
  491.            Move.w    #_Farg15,$dff19e
  492.  
  493.            Move.w    #$2020,$dff106
  494.  
  495.            Move.w    #SprCol,$dff180
  496.            Move.w    #SprCol,$dff182
  497.            Move.w    #SprCol,$dff184
  498.            Move.w    #SprCol,$dff186
  499.            Move.w    #SprCol,$dff188
  500.            Move.w    #SprCol,$dff18a
  501.            Move.w    #SprCol,$dff18c
  502.            Move.w    #SprCol,$dff18e
  503.            Move.w    #SprCol,$dff190
  504.            Move.w    #SprCol,$dff192
  505.            Move.w    #SprCol,$dff194
  506.            Move.w    #SprCol,$dff196
  507.            Move.w    #SprCol,$dff198
  508.            Move.w    #SprCol,$dff19a
  509.            Move.w    #SprCol,$dff19c
  510.            Move.w    #SprCol,$dff19e
  511. ;;;
  512.            ENDC
  513. ;;; "                 Init Colours"
  514.            Moveq     #16,d0
  515.            Moveq     #15-1,d6
  516. .collop2
  517.  
  518.            Moveq     #16-1,d7
  519. .collop1
  520.            Move.l    #15,d1
  521.            Sub.l     d7,d1
  522.            Lsl.l     #4,d1
  523.            Move.l    #15,d2
  524.            Sub.l     d6,d2
  525.            Lsl.l     #4,d2
  526.            Add.l     d2,d1
  527.            Lsr.l     #1,d1
  528.  
  529.            Move.l    d1,d2
  530.            Move.l    d1,d3
  531.            Bsr       _SetColByte
  532.            Addq.l    #1,d0
  533.            Dbra      d7,.collop1
  534.            Dbra      d6,.collop2
  535.  
  536.            ;-------------------
  537.  
  538.            Moveq     #16-1,d7
  539. .lop               Move.l    d7,d0
  540.            Moveq     #0,d1
  541.            Move.l    d1,d2
  542.            Move.l    d1,d3
  543.            Bsr       _SetColByte
  544.            Dbra      d7,.lop
  545. ;;;
  546. ;;; "                 Install Copperlist"
  547.            Lea       Custom,a5
  548.            Move.w    #DMAF_SETCLR!DMAF_SPRITE,dmacon(a5)
  549.  
  550.            Move.l    CopperPtr,a0
  551.            Jsr       _InstallCopper
  552. ;;;
  553.            Rts
  554.  
  555. Fastest_Counter:
  556. ;;; "                 Add Counters"
  557. AddCounters:       ;Add.l     #1,Fastest_Angle
  558.            ;And.l     #1023,Fastest_Angle
  559.  
  560.            ;Add.l      #1024,Fastest_XOff
  561.            ;Add.l      #1024,Fastest_YOff
  562.  
  563.            ;Add.l     #4,Zoom
  564.            ;And.l     #1023,Zoom
  565.  
  566.            ;Lea       _Sin1024,a0
  567.            ;Move.l    Zoom,d0
  568.            ;Move.w    (a0,d0*2),d3
  569.            ;Asl.w     #1,d3
  570.            ;Add.w     #512+DIST,d3
  571.            ;Move.w    d3,Fastest_Zoom
  572. ;;;
  573.            Rts
  574.  
  575. Fastest_Main:
  576. ;;; "                 Make Adders"
  577.            Lea       _Sin1024,a0
  578.            Moveq     #0,d7
  579.  
  580.            Move.w    Fastest_Zoom,d3
  581.  
  582.            Move.l    Fastest_Angle,d0
  583.            And.l     #1023,d0
  584.            Move.w    (a0,d0*2),d1
  585.            Muls.w    d3,d1
  586.            Asr.l     #8,d1
  587.            Addx.l    d7,d1
  588.  
  589.            Add.l     #256,d0
  590.            And.l     #1023,d0
  591.            Move.w    (a0,d0*2),d2
  592.            Muls.w    d3,d2
  593.            Asr.l     #8,d2
  594.            Addx.l    d7,d2
  595.  
  596.            Move.l    d2,Yadd1
  597.            Move.l    d1,Yadd2
  598.            Move.l    d1,Xadd1
  599.            Neg.l     d2
  600.            Move.l    d2,Xadd2
  601. ;;;
  602. ;;; "                 Make Offset Table"
  603.            Moveq     #0,d6
  604.  
  605.            Move.l    Yadd1,a4
  606.            Move.l    Yadd2,a5
  607.  
  608.            Lea       PlotLop,a0
  609.            Lea       OffsetTable,a2
  610.  
  611.            Moveq     #0,d2
  612.            Moveq     #0,d1
  613.            Moveq     #0,d0
  614.            Move.l    #16-1,d7
  615.  
  616. MakeTable:         Sub.l     a4,d1
  617.            Sub.l     a5,d2
  618.  
  619.            Move.l    d1,d0
  620.            Asr.l     #8,d0
  621.            Addx.l    d6,d0
  622.            Asl.l     #8,d0
  623.  
  624.            Move.l    d2,d3
  625.            Asr.l     #8,d3
  626.            Addx.l    d6,d0
  627.            Move.b    d3,d0
  628.            Asl.w     #1,d0               ;Words...
  629.            Move.l    (a2)+,d5            ;Get inst. offset
  630.            Move.w    d0,(a0,d5)          ;Poke instruction
  631.  
  632.            Dbra      d7,MakeTable
  633. ;;;
  634. ;;; "                 Make Offset Table (16 Steps)"
  635.            Moveq     #0,d6
  636.  
  637.            Move.l    Yadd1,d0
  638.            Asl.l     #4,d0
  639.            Move.l    d0,a4
  640.            Move.l    Yadd2,d0
  641.            ;Asl.l     #4,d0
  642.            Move.l    d0,a5
  643.  
  644.            Lea       TempTable,a0
  645.  
  646.            Moveq     #0,d2
  647.            Moveq     #0,d1
  648.            Moveq     #0,d0
  649.            Move.l    #16-1,d7
  650.  
  651. MakeTable16:       Add.l     a4,d1
  652.            Add.l     a5,d2
  653.  
  654.            Move.l    d1,d0
  655.            Asr.l     #8,d0
  656.            Addx.l    d6,d0
  657.            Asl.l     #8,d0
  658.  
  659.            Move.l    d2,d3
  660.            Asr.l     #4,d3
  661.            Addx.l    d6,d0
  662.            Move.b    d3,d0
  663.  
  664.            Asl.w     #1,d0               ;Words...
  665.            Move.w    d0,(a0)+            ;Poke instruction
  666.  
  667.            Dbra      d7,MakeTable16
  668. ;;;
  669. ;;; "                 Calculate Starting point"
  670.            Lea       _Sin1024,a0
  671.            Moveq     #0,d7
  672.  
  673.            Move.w    Fastest_Zoom,d3
  674.  
  675.            Move.l    Fastest_XOff,d4
  676.            Move.l    Fastest_YOff,d5
  677.  
  678.            ;--------------------------
  679.  
  680.            Move.l    Fastest_Angle,d0
  681.            Add.l     #256,d0
  682.            And.l     #1023,d0
  683.            Move.w    (a0,d0*2),d1
  684.            Muls.w    d3,d1
  685.            Muls.l    #-160/2,d1
  686.  
  687.            Sub.l     #256,d0
  688.            And.l     #1023,d0
  689.            Move.w    (a0,d0*2),d2
  690.            Muls.w    d3,d2
  691.            Muls.l    #-128/2,d2
  692.  
  693.            Add.l     d2,d1
  694.            Asr.l     #8,d1
  695.            Addx.l    d7,d1
  696.            Add.l     d4,d1
  697.            Move.l    d1,XStart
  698.  
  699.            ;--------------------------
  700.  
  701.            Move.l    Fastest_Angle,d0
  702.            Add.l     #0,d0
  703.            And.l     #1023,d0
  704.            Move.w    (a0,d0*2),d1
  705.            Muls.w    d3,d1
  706.            Muls.l    #-160/2,d1
  707.  
  708.            Add.l     #256,d0
  709.            And.l     #1023,d0
  710.            Move.w    (a0,d0*2),d2
  711.            Muls.w    d3,d2
  712.            Muls.l    #-128/2,d2
  713.  
  714.            Sub.l     d2,d1
  715.            Asr.l     #8,d1
  716.            Addx.l    d7,d1
  717.            Add.l     d5,d1
  718.            Move.l    d1,YStart
  719. ;;;
  720. ;;; "                 Clear Cache"
  721.            Move.l    _ExecBase,a6
  722.            Jsr       _LVOCacheClearU(a6)
  723.            Nop
  724. ;;;
  725. ;;; "                 Plot"
  726.            Move.l    ScrPtr1,a2
  727.            Move.l    ScrPtr2,a3
  728.  
  729.            Move.l    XStart,XCurr1
  730.            Move.l    YStart,XCurr2
  731.  
  732.            Move.l    #128-1,YCount
  733. YLine:
  734.            Move.l    Xadd2,d1
  735.            Add.l     d1,XCurr2
  736.            Move.l    Xadd1,d1
  737.            Add.l     d1,XCurr1
  738.  
  739.            Moveq     #0,d6
  740.            Move.l    XCurr1,d1
  741.            Asr.l     #8,d1
  742.            Addx.l    d6,d1
  743.            Asl.l     #8,d1
  744.  
  745.            Move.l    XCurr2,d0
  746.            Asr.l     #8,d0
  747.            Addx.l    d6,d0
  748.            Move.b    d0,d1
  749.            Asl.w     #1,d1               ;Words...
  750.            Move.w    d1,d6
  751.  
  752.            Move.l    TexturePtr1,a4
  753.            Add.l     #256*256,a4
  754.            Move.l    TexturePtr2,a5
  755.            Add.l     #256*256,a5
  756.  
  757.            Lea       TempTable,a6
  758.  
  759.            Move.l    #%00110011001100110011001100110011,d4
  760.            Move.l    #%11001100110011001100110011001100,d5
  761.  
  762.            Move.l    #160/16-1,d7
  763.  
  764. XLine:             Move.w    (a6)+,d0
  765.            Add.w     d6,d0
  766.  
  767.            Move.l    a4,a0
  768.            Add.w     d0,a0
  769.            Move.l    a5,a1
  770.            Add.w     d0,a1
  771.  
  772. PlotLop:           Move.w    2(a0),d3
  773.            Or.w      2(a1),d3
  774.            Move.b    2(a0),d3
  775.            Or.b      2(a1),d3
  776.            Swap      d3
  777.            Move.w    2(a0),d3
  778.            Or.w      2(a1),d3
  779.            Move.b    2(a0),d3
  780.            Or.b      2(a1),d3
  781.  
  782.            Move.w    2(a0),d2
  783.            Or.w      2(a1),d2
  784.            Move.b    2(a0),d2
  785.            Or.b      2(a1),d2
  786.            Swap      d2
  787.            Move.w    2(a0),d2
  788.            Or.w      2(a1),d2
  789.            Move.b    2(a0),d2
  790.            Or.b      2(a1),d2
  791.  
  792.            ;- - - - - - - - - - - - -
  793.  
  794.            Move.l    d2,d1
  795.            Move.l    d3,d0
  796.  
  797.            And.l     d4,d2
  798.            And.l     d5,d1
  799.            And.l     d4,d3
  800.            And.l     d5,d0
  801.  
  802.            Lsl.l     #2,d2
  803.            Lsr.l     #2,d0
  804.  
  805.            Or.l      d3,d2
  806.            Or.l      d0,d1
  807.            Move.l    d2,(a2)+
  808.            Move.l    d1,(a3)+
  809.  
  810.            Dbra      d7,XLine
  811.  
  812.            Subq.l    #1,YCount
  813.            Bge       YLine
  814. ;;;
  815. ;;; "                 Screen Swap"
  816.            Move.l    ScrPtr1,d0
  817.            Move.l    ViewPtr1,ScrPtr1
  818.            Move.l    d0,ViewPtr1
  819.  
  820.            Move.l    ScrPtr2,d0
  821.            Move.l    ViewPtr2,ScrPtr2
  822.            Move.l    d0,ViewPtr2
  823.  
  824.            ;--------------------------
  825.  
  826.            Move.l    BplPtr,a0
  827.            Move.l    ViewPtr1,d1
  828.            Moveq     #2-1,d2
  829.            Move.l    #0,d0
  830.            Jsr       _SetPtrs
  831.  
  832.            Move.l    BplPtr,a0
  833.            Lea       16(a0),a0
  834.            Move.l    ViewPtr2,d1
  835.            Moveq     #2-1,d2
  836.            Move.l    #0,d0
  837.            Jsr       _SetPtrs
  838.  
  839.            ;- - - - - - - - - - - - -
  840.  
  841.            Move.l    BplPtr2,a0
  842.            Move.l    ViewPtr1,d1
  843.            ;Add.l     #40,d1
  844.            Moveq     #2-1,d2
  845.            Move.l    #0,d0
  846.            Jsr       _SetPtrs
  847.  
  848.            Move.l    BplPtr2,a0
  849.            Lea       16(a0),a0
  850.            Move.l    ViewPtr2,d1
  851.            ;Add.l     #40,d1
  852.            Moveq     #2-1,d2
  853.            Move.l    #0,d0
  854.            Jsr       _SetPtrs
  855.  
  856. ;;;
  857.            Rts
  858.  
  859. Fastest_Remove:
  860. ;;; "                 Free Memory"
  861. CloseScreen:       Move.l    #Fastest_ID,d0
  862.            Jsr       _FreeMany
  863. ;;;
  864.            Rts
  865.  
  866. ***************************************
  867. *                Data...              *
  868. ***************************************
  869.  
  870. ;;; "Variables / Tables"
  871.            Cnop      0,8
  872.  
  873. Int1:              Dc.l      0
  874.  
  875. Temp1:             Dc.l      0
  876. Temp2:             Dc.l      0
  877. Temp3:             Dc.l      0
  878. Temp4:             Dc.l      0
  879.  
  880. YCount:            Dc.l      0
  881.  
  882. Even:              Dc.l      0
  883. Yadd1:             Dc.l      0
  884. Yadd2:             Dc.l      0
  885. Xadd1:             Dc.l      0
  886. Xadd2:             Dc.l      0
  887.  
  888. XCurr1:            Dc.l      0
  889. XCurr2:            Dc.l      0
  890. Begin1:            Dc.l      0
  891. Begin2:            Dc.l      0
  892.  
  893. XStart:            Dc.l      0
  894. YStart:            Dc.l      0
  895.  
  896. Zoom:              Dc.l      0
  897.  
  898. Fastest_Angle:     Dc.l      0
  899. Fastest_Zoom:      Dc.l      0
  900. Fastest_XOff:      Dc.l      0
  901. Fastest_YOff:      Dc.l      0
  902.  
  903. ScrPtr1:           Dc.l      0
  904. ScrPtr2:           Dc.l      0
  905. ViewPtr1:          Dc.l      0
  906. ViewPtr2:          Dc.l      0
  907. Plane5Ptr:         Dc.l      0
  908.  
  909. CopperPtr:         Dc.l      0
  910. BplPtr:            Dc.l      0
  911. BplPtr2:           Dc.l      0
  912. SprPtr:            Dc.l      0
  913.  
  914. Sprite1:           Dc.l      0
  915. Sprite2:           Dc.l      0
  916. Sprite3:           Dc.l      0
  917. Sprite4:           Dc.l      0
  918. Sprite5:           Dc.l      0
  919.  
  920. TexturePtr1:       Dc.l      0
  921. TexturePtr2:       Dc.l      0
  922.  
  923.  
  924. OffsetTable:       Dc.l      28,62,32,66,20,54,24,58
  925.            Dc.l      10,44,14,48, 2,36, 6,40
  926.  
  927. TempTable:         Dc.w      0,0,0,0,0,0,0,0
  928.            Dc.w      0,0,0,0,0,0,0,0
  929.  
  930. ScrambleTable2:    Dc.l      9,1,8,0,11,3,10,2
  931.            Dc.l      13,5,12,4,15,7,14,6
  932. ;;;
  933.  
  934.            Section   data,DATA
  935. ;;; "Texture"
  936.            Cnop      0,8
  937. Texture:           Incbin    "!intro:fastest/textures/atomic.4bit"
  938. ;;;
  939.  
  940.